package com.atguigu.eduservice.controller;

import com.alibaba.fastjson.JSONObject;
import com.atguigu.baseservice.result.R;
import com.atguigu.eduservice.entity.EduSubject;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@Api(description = "登录管理")
@RestController
@RequestMapping("/edu/user")
public class EduLoginController {


    /**
     * 登录
     * @return
     */
    @PostMapping("/login")
    public R login(){
        return R.ok().data("token", "admin");
    }

    /**
     * 信息
     * @return
     */
    @GetMapping("/info")
    public R info(){
        return R.ok().data("roles", "[admin]")
                .data("name", "admin")
//                .data("password", "admin");
                .data("avatar", "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
    }


    @PostMapping("/test")
    public R test(@RequestBody EduSubject eduSubject) {

        System.out.println(eduSubject);
//        System.out.println(type);
//        System.out.println(token);
//        list.forEach(System.out::println);

        return R.ok();
    }

}
